<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                template="/templates/ui.xhtml">

<ui:define name="head">
    <script type="text/javascript" src="#{request.contextPath}/UI/support/pub.js"/>
    <script type="text/javascript" language="javascript">
        document.onkeydown = function TabReplace() {
            if (event.keyCode == 13) {
                if (event.srcElement.tagName != 'BUTTON')
                    event.keyCode = 9;
                else
                    event.srcElement.click();
            }
        }
        function actSelect(obj) {
            var pkid = obj;
            var sfeature = "dialogwidth:1300px;dialogheight:700px;center:yes;location:no;help:no;resizable:no;scroll:yes;status:no";
            var arg = new Object();
            arg.doType = "select";

            var strCallPageNameFlag = document.getElementById("form:hiCallPageNameFlag").value;
            if (strCallPageNameFlag == "SubcttEngStaDoubleCheck") {
                var rtn = dialog("../item/itemHieRelapQry_TkcttEngStaStl.xhtml?strEsInitStlSubcttEng=" + pkid + "", arg, sfeature);
            }
            else if (strCallPageNameFlag == "SubcttEngMeaDoubleCheck") {
                var rtn = dialog("../item/itemHieRelapQry_TkcttEngMeaStl.xhtml?strEsInitStlSubcttEng=" + pkid + "", arg, sfeature);
            }
        }
    </script>

    <style type="text/css">
        .img {
            width: 20px;
            height: 30px;
        }

        .c_c {
            background: gray;
        }
    </style>
</ui:define>
<ui:define name="content">
    <div style="margin:5px;">
        <h:form id="form" enctype="multipart/form-data">
            <p:growl id="msgs" showDetail="true"/>
            <p:focus for="id"/>
            <p:panel id="ppCondition" header="工程数量_统计计量复核" style="width: 100%">
                <h:panelGrid>
                    <h:selectOneRadio id="radio" value="#{esPowerAction.strOperType}">
                        <f:selectItem itemLabel="查询" itemValue="strRadioQry"/>
                        <f:selectItem itemLabel="编辑" itemValue="strRadioEdit"/>
                        <p:ajax update="ppCondition,pdt"
                                listener="#{esInitTkcttStlMeaAction.radioOnClickForPowerAction('DoubleCheck')}"/>
                    </h:selectOneRadio>
                </h:panelGrid>
                <h:panelGrid columns="2" style="width: 100%">
                    <h:panelGrid id="pgCondition">
                        <h:panelGrid columns="4" rendered="false">
                            <h:outputLabel value="结算类型：" for="stlType" style="font-weight: bold"/>
                            <p:inputText id="stlType" value="#{esInitTkcttStlMeaAction.itemEsInitStl.stlType}"/>
                        </h:panelGrid>
                        <h:panelGrid columns="6">
                            <h:outputLabel value="结算编号：" for="id" style="font-weight: bold"/>
                            <p:inputText id="id" value="#{esInitTkcttStlMeaAction.itemEsInitStl.id}"
                                         disabled="#{esInitTkcttStlMeaAction.styleModel.disabled_Flag}"
                                         style="#{esInitTkcttStlMeaAction.styleModel.disabled_Style};width:127px"/>

                            <h:outputLabel value="分包合同：" for="stlPkid" style="font-weight: bold"/>
                            <p:selectOneMenu id="stlPkid"
                                             value="#{esInitTkcttStlMeaAction.itemEsInitStl.stlPkid}"
                                             disabled="#{esInitTkcttStlMeaAction.styleModel.disabled_Flag}"
                                             style="#{esInitTkcttStlMeaAction.styleModel.disabled_Style};width:131px">
                                <f:selectItems value="#{esInitTkcttStlMeaAction.subcttList}"/>
                            </p:selectOneMenu>

                            <h:outputLabel value="期数编码：" for="periodNo" style="font-weight: bold"/>
                            <p:inputText id="periodNo" value="#{esInitTkcttStlMeaAction.itemEsInitStl.periodNo}"
                                         onclick="WdatePicker({dateFmt:'yyyyMM'})"
                                         disabled="#{esInitTkcttStlMeaAction.styleModel.disabled_Flag}"
                                         style="#{esInitTkcttStlMeaAction.styleModel.disabled_Style};width:127px"/>
                        </h:panelGrid>

                        <h:panelGrid columns="6">
                            <h:outputLabel value="状态标志：" for="statusFlag" style="font-weight: bold"/>
                            <p:selectOneMenu id="statusFlag" value="#{esInitTkcttStlMeaAction.itemEsInitStl.statusFlag}"
                                             style="width:131px">
                                <f:selectItems value="#{esPowerAction.statusFlagList}"/>
                            </p:selectOneMenu>

                            <h:outputLabel value="结束标志：" for="endFlag"
                                           style="font-weight: bold"/>
                            <p:selectOneMenu id="endFlag" value="#{esInitTkcttStlMeaAction.itemEsInitStl.endFlag}"
                                             disabled="#{esInitTkcttStlMeaAction.styleModel.disabled_Flag}"
                                             style="#{esInitTkcttStlMeaAction.styleModel.disabled_Style};width:131px">
                                <f:selectItems value="#{esPowerAction.endFlagList}"/>
                            </p:selectOneMenu>

                            <h:outputLabel value="删除标志：" for="deletedFlag" style="font-weight: bold"/>
                            <p:selectOneMenu id="deletedFlag"
                                             value="#{esInitTkcttStlMeaAction.itemEsInitStl.deletedFlag}"
                                             disabled="#{esInitTkcttStlMeaAction.styleModel.disabled_Flag}"
                                             style="#{esInitTkcttStlMeaAction.styleModel.disabled_Style};width:131px">
                                <f:selectItems value="#{esPowerAction.deleteFlagList}"/>
                            </p:selectOneMenu>
                        </h:panelGrid>

                        <h:panelGrid columns="2">
                            <h:outputLabel value="备注内容：" for="note" style="font-weight: bold"/>
                            <p:inputTextarea id="note" value="#{esInitTkcttStlMeaAction.itemEsInitStl.note}"
                                             rows="1" autoResize="false" style="width:128px"/>
                        </h:panelGrid>
                    </h:panelGrid>
                    <h:panelGrid style="width:10%">
                        <p:commandButton id="qryBtn" value="查询"
                                         action="#{esInitTkcttStlMeaAction.onQueryAction('False')}"
                                         style="width:90px"
                                         update="pdt,msgs"
                                         rendered="#{esPowerAction.strBtnQryRendered}">
                        </p:commandButton>
                        <p:commandButton id="checkPassBtn" value="复核通过"
                                         action="#{esInitTkcttStlMeaAction.onClickForPowerAction('DoubleCheckPass')}"
                                         style="width:90px"
                                         update="ppCondition,pdt,msgs"
                                         rendered="#{esPowerAction.strBtnEditRendered}">
                        </p:commandButton>
                        <p:commandButton id="checkFailBtn" value="复核未过"
                                         action="#{esInitTkcttStlMeaAction.onClickForPowerAction('DoubleCheckFail')}"
                                         style="width:90px"
                                         update="ppCondition,pdt,msgs"
                                         rendered="#{esPowerAction.strBtnEditRendered}">
                        </p:commandButton>
                        <p:commandButton id="resetBtn" value="重置"
                                         action="#{esInitTkcttStlMeaAction.resetAction}"
                                         style="width:90px"
                                         update="ppCondition,msgs">
                        </p:commandButton>
                    </h:panelGrid>
                </h:panelGrid>
            </p:panel>

            <h:inputHidden id="hiCallPageNameFlag"
                           value="#{esInitTkcttStlMeaAction.strCallPageNameFlag}"></h:inputHidden>

            <p:ajaxStatus style="width:16px;height:16px;">
                <f:facet name="start">
                    <h:graphicImage value="/images/ajaxloading.gif"/>
                </f:facet>
                <f:facet name="complete">
                    <h:outputText value=""/>
                </f:facet>
            </p:ajaxStatus>

            <!--列表维护-->
            <p:contextMenu for="pdt">
                <p:menuitem value="选择" icon="ui-icon-plus"
                            actionListener="#{esInitTkcttStlMeaAction.selectRecordAction('DoubleCheck','')}"
                            update="pdt,msgs,ppCondition">
                </p:menuitem>
                <p:menuitem value="详细内容" icon="ui-icon-search"
                            oncomplete="actSelect(DtInitSubcttList.selection)">
                </p:menuitem>
            </p:contextMenu>
            <p:dataTable id="pdt" style="width:100%;"
                         value="#{esInitTkcttStlMeaAction.initSubcttList}"
                         var="record"
                         rowKey="#{record.pkid}"
                         selection="#{esInitTkcttStlMeaAction.itemEsInitStlSelected}"
                         selectionMode="single"
                         paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                         paginator="true"
                         paginatorPosition="bottom"
                         rows="15"
                         rowsPerPageTemplate="100,50,30,15,5"
                         emptyMessage="数据记录为空..."
                         widgetVar="DtInitSubcttList"
                         rowStyleClass="#{record.statusFlag eq '1'? null :
                                                 record.statusFlag eq '2'? null: 'c_c'}">

                <!--<p:ajax event="rowSelect" listener="#{esInitSubcttStlQMPAction.onRowSelect}" update=":form"/>-->

                <p:column headerText="pkid" style="display:none;" rendered="false">
                    <h:outputText id="tetid" style="display:none;" rendered="false" value="#{record.pkid}"/>
                </p:column>

                <p:column headerText="结算编号" style="text-align:center">
                    <h:outputText value="#{record.id}"/>
                </p:column>

                <p:column headerText="分包合同" style="text-align:center">
                    <h:outputText value="#{esInitTkcttStlMeaAction.getSubcttNameByIdFromList(record.stlPkid)}"/>
                </p:column>

                <p:column headerText="期数编码" style="text-align:center">
                    <h:outputText value="#{record.periodNo}"/>
                </p:column>

                <p:column headerText="今期状态" style="text-align:center">
                    <h:outputText value="#{esPowerAction.getLabelByValueInStatusFlaglist(record.statusFlag)}"/>
                </p:column>

                <p:column headerText="今期原因" style="text-align:center">
                    <h:outputText value="#{esPowerAction.getLabelByValueInPreStatusFlaglist(record.preStatusFlag)}"/>
                </p:column>

                <p:column headerText="前期状态" style="text-align:center">
                    <h:outputText
                            value="#{esPowerAction.getLabelByValueInStatusFlaglist(record.lastPeriodStlStatusFlag)}"/>
                </p:column>

                <p:column headerText="前期原因" style="text-align:center">
                    <h:outputText
                            value="#{esPowerAction.getLabelByValueInPreStatusFlaglist(record.lastPeriodStlPreStatusFlag)}"/>
                </p:column>

                <p:column headerText="结束标志" style="text-align:center">
                    <h:outputText value="#{esPowerAction.getLabelByValueInEndFlagList(record.endFlag)}"/>
                </p:column>
            </p:dataTable>
        </h:form>
    </div>
</ui:define>
</ui:composition>